package com.cc.springbootvalidatedemo.domain;

import com.cc.springbootvalidatedemo.utils.ValidPhone;
import jakarta.validation.constraints.*;
import lombok.Data;

@Data
public class User {

    @NotNull(groups = CreateGroup.class, message = "用户名不能为空")
    private String username;

    @NotBlank
    private String password;

    @Size(min=2)
    private String[] tags;

    @Min(value = 18, groups = UpdateGroup.class, message = "年龄需≥18")
    private Integer age;

    @Email
    private String email;

    @ValidPhone(groups = CreateGroup.class, message = "手机号格式不正确", code = 101000100)
    private String phone;
}
